package com.nhii.base.common.LayoutManagement;

import android.app.Activity;
import android.graphics.Color;

import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.view.TimePickerView;

import java.util.Calendar;
import java.util.Date;

/**
 * author : Alex
 * e-mail : xys9786@outlook.com
 * date   : 2020/5/1116:36
 * desc   :
 * version: 1.0
 */
public class TimePickerViewManagement {


    /**
     * 时间 选择器 配置文件
     * @param timePickerBuilder
     * @param title
     * @return
     */
    public static TimePickerView showTimePickerView(TimePickerBuilder timePickerBuilder, String title){

        //打开选择器 选中的时间
        Calendar selectedDate = Calendar.getInstance();
        selectedDate.setTime(new Date());

        // 开始时间
        Calendar startDate = Calendar.getInstance();
        startDate.set(2013,1,1);

        //  结束时间
        Calendar endDate = Calendar.getInstance();
        endDate.set(2020,1,1);

        timePickerBuilder.isAlphaGradient(true);// 是否渐变

        timePickerBuilder.setType(new boolean[]{false, true, true, true, true, false});//分别对应年月日时分秒，默认全部显示

        timePickerBuilder.setCancelText("取消");//取消按钮文字

        timePickerBuilder.setSubmitText("确定");//确认按钮文字;

        timePickerBuilder.setTitleText(title);// 标题文字

        timePickerBuilder.isAlphaGradient(true);// 是否渐变

        timePickerBuilder.setOutSideCancelable(false);// //点击屏幕，点在控件外部范围时，是否取消显示

        timePickerBuilder.setTitleColor(Color.BLACK)//标题文字颜色
                .setSubmitColor(Color.BLUE)//确定按钮文字颜色
                .setCancelColor(Color.BLUE);//取消按钮文字颜色

        timePickerBuilder.setDate(selectedDate);// 如果不设置的话，默认是系统时间*/

        timePickerBuilder.setLabel("","月","日","时","分","");

        return timePickerBuilder.build();


    }



}
